package lab02.Test06;

public class Triangle {
    //	Triangle类具有类型为double的三个边，以及周长、面积属性，Triangle类具有返回周长
    // 面积以及修改三个边的功能。另外，Triangle类还具有一个Boolean型的属性，该属性用来判断三个属能否构成一个三角形。
    private double a;
    private double b;
    private double c;
    private double perimeter;
    private double area;
    boolean triangle;

    //方法
    public Triangle() {

    }

    public Triangle(double a, double b, double c, double area, double perimeter) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.perimeter = perimeter;
        this.area = area;
    }


    public double getArea(double a, double b, double c) {
        double area = (a + b + c) / 2;
        double x=area*(area-a)*(area-b)*(area-c);
        area=(double) Math.sqrt(x);
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public double getPerimeter(double a, double b, double c) {
        double perimeter = a + b + c;
        return perimeter;
    }

    public void setPerimter(double perimter) {
        this.perimeter = perimeter;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    public void setTriangle(boolean triangle) {
        this.triangle = triangle;
    }

    public boolean isTriangle(double a, double b, double c) {
        if (a + b > c && a + c > b && b + c > a) {
            return true;

        } else {
           return false;
        }
    }
}
